from typing import Tuple

import numpy as np
from numpy import ndarray

from alphalib.contrib.strategy import z1_conf_types, z1_strategy

stg_list = []

def weight_func() -> Tuple[list, ndarray]:
    bh_list = [120, 360, 1080,]
    return bh_list, np.ones(len(bh_list))

for n, w in zip(*weight_func()):
    strategy_conf = z1_strategy.Z1StrategyConfig(
        strategy_name=f'ILLQStdV0_bh_{n}',
        hold_period=2,
        long_factors=[z1_conf_types.F1FactorConfig('ILLQStdV0', False, n, 0, 1)],
        short_factors=[z1_conf_types.F1FactorConfig('ILLQStdV0', False, n, 0, 1)],
        filter_before_params=[
            z1_conf_types.F1FilterParams('df1', 'PctChange_fl_168', 'pct', 'lte', 0.9, False, False),
            z1_conf_types.F1FilterParams('df2', 'PctChange_fl_168', 'pct', 'lte', 0.9, False, False),
        ],
        if_use_spot=True,
        long_weight=1,
        short_weight=1,
        long_coin_num=.1,
        short_coin_num=.1,
    )
    stg_list.append(z1_strategy.Z1Strategy(strategy_conf))

strategy = z1_strategy.Z1MultiStrategy(stg_list)
